home *** CD-ROM | disk | FTP | other *** search
/ Tech Arsenal 1 / Tech Arsenal (Arsenal Computer).ISO / tek-04 / bipl.zip / PROCS.ZIP / FACTORL.ICN < prev    next >
Text File  |  1992-09-28  |  736b  |  34 lines

  1. ############################################################################
  2. #
  3. #    File:     factorl.icn
  4. #
  5. #    Subject:  Procedure for computing factorials
  6. #
  7. #    Author:   Ralph E. Griswold
  8. #
  9. #    Date:     September 6, 1992
  10. #
  11. ###########################################################################
  12. #
  13. #  factorl(n) returns n!  It fails if n is less than 0
  14. #
  15. ############################################################################
  16. #
  17. #  Requires:  Large-integer arithmetic except for small values of n
  18. #
  19. ############################################################################
  20.  
  21. procedure factorl(n)
  22.  
  23.    n := integer(n) | fail
  24.  
  25.    if n < 0 then fail
  26.  
  27.    i := 1
  28.  
  29.    every i *:= 1 to n
  30.  
  31.    return i
  32.  
  33. end
  34.